﻿using System;
using System.Collections.Generic;
using System.Text;
using Watchdog.Bll.Factory;

namespace Watchdog.Bll.Base {

    public partial class TestTargetStatusBase {

        #region [ Local variables ]
        Facade.TestTargetStatus intdata;
        #endregion

        #region [ Constructor(s) ]
        internal TestTargetStatusBase () {
            intdata = new Watchdog.Facade.TestTargetStatus ();
        }
        internal TestTargetStatusBase (Facade.TestTargetStatus testtargetstatus) : base () {
            intdata = testtargetstatus;
        }
        #endregion

        #region [ Field Properties ]
        public int Test {
            get { return intdata.Test; }
        }
        public int Target {
            get { return intdata.Target; }
        }
        public virtual DateTime Started {
            get { return intdata.Started; }
            set { intdata.Started = value; }
        }
        public virtual string Status {
            get { return intdata.Status; }
            set { intdata.Status = value; }
        }
		#endregion
		
        #region [ Data Methods ]
        public void Update () {
            if (Id == -1)
                TestTargetStatusFactory.Insert ( this );
            else
                TestTargetStatusFactory.Update ( this );
        }

        public void Delete () {
            TestTargetStatusFactory.Delete ( this );
        }
        #endregion

		#region [ Many to many relations native type ]

		#endregion

		#region [ Add & Remove methods for many to many relations native type ]

		#endregion
		
        internal Facade.TestTargetStatus IntData {
            get { return intdata; }
            set { intdata = value; }
        }

        #region [ Equality ]
        public override int GetHashCode () {
            return Id;
        }
        public static bool operator == ( TestTargetStatusBase lt1, TestTargetStatusBase lt2 ) {
            if (System.Object.ReferenceEquals ( lt1, lt2 ))
                return true;

            if ((object)lt1 == null || (object)lt2 == null)
                return false;
            return lt1.Equals ( lt2 );
        }
        public static bool operator != ( TestTargetStatusBase lt1, TestTargetStatusBase lt2 ) {
            if (lt1 == null || lt2 == null)
                return false;
            return !(lt1 == lt2);
        }

        public override bool Equals ( object obj ) {
            if (!(obj is TestTargetStatusBase))
                return false;
            return (this.CompareTo ( obj ) == 0);
        }

        private int CompareTo ( object obj ) {
            if (!(obj is TestTargetStatusBase)) {
                throw new ArgumentException ( "A 'TestTargetStatusBase' object is required for comparison." );
            }
            return this.Test.CompareTo ( ((TestTargetStatusBase)obj).Test );
        }
        #endregion

	}
}
